<?php
namespace common\services;

use common\base\BaseActiveRecord;
use common\models\AccessLog;
use yii\data\Pagination;

class AccessLogServices extends AccessLog
{

    public function insertAccessLog($channel, $uid = ''){
        $model = new AccessLog();
        $model->uid = $uid;
        $model->channel = $channel;
        $model->sess_id = session_id();
        $model->page = \Yii::$app->requestedRoute;
        $model->access_url = \Yii::$app->request->hostInfo.\Yii::$app->request->url;
        $model->referer_url = \Yii::$app->request->referrer;
        $model->method = \Yii::$app->request->method;
        $model->save();
        return true;
    }

}
